

export const tableOption = {
    "border": true,
    "index": true,
    "indexLabel": "#",
    "stripe": true,
    "menuAlign": "center",
    "align": "center",
    "searchMenuSpan": 6,
    searchEnter: true,
    selection: true,
    grid: window.isMobile,
    gridSpan: 24,
    menuWidth: 600,
    "column": [
        {
            "type": "input",
            "label": "证书名称",
            "prop": "name",
            "overHidden": false,
            "rules": [{
                required: true,
                message: '证书名称不能为空',
                trigger: 'blur'
            }],
            'search': true,
            "span": 12
        }
        ,
        {
            "type": "input",
            "label": "模型对应的数据库",
            "prop": "modelDB",
            "overHidden": false,
            hide: true,
            display: false,
            value: "test"
        }
        ,
        {
            "type": "input",
            "label": "描述",
            "prop": "remark",
            "overHidden": false,

            "rules": [{
                required: true,
                message: '描述不能为空',
                trigger: 'blur'
            }],
            'search': true,
            "span": 12
        }
        ,
        {
            "type": "select",
            "label": "发布状态",
            "prop": "status",
            'search': true,
            "minWidth": "60px",
            dicData: [
                {"label": "未发布", "value": 0},
                {"label": "已发布", "value": 1}
            ],
            "span": 12
        }

    ]
}

export const convertImageToBase64 = (url, callback,that) => {
    var canvas = document.createElement('CANVAS');
    var ctx = canvas.getContext('2d');
    var img = new Image();
    img.crossOrigin = 'Anonymous';
    img.onload = function () {
        canvas.height = img.height;
        canvas.width = img.width;
        ctx.drawImage(img, 0, 0);
        let dataURL = canvas.toDataURL('image/png');
        callback.call(this, dataURL, that);
        canvas = null;
    };
    img.src = url;
}



